<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

        // `localStorage.setItem('自定义值', 要设置的内容)   往本地设置值`
        localStorage.setItem('str',  123 )
        // 取值
        console.log(localStorage.getItem('str' ))

        //  本地存储 只能存储字符串  如果是复杂类型 需要把他们转换成 字符串 

        localStorage.setItem('arr',  JSON.stringify([100,200,300]) )

        console.log(JSON.parse(localStorage.getItem('arr' )))
    </script>
</body>
</html>